//
//  RenHouseBottomView.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/19.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "RenHouseBottomView.h"
#import <LEEAlert/LEEAlert.h>

@interface RenHouseBottomView ()
@property (weak, nonatomic) IBOutlet UIImageView *leftImageView;
@property (weak, nonatomic) IBOutlet UILabel *leftLabel;

@property (weak, nonatomic) IBOutlet UIImageView *middleImageView;

@property (weak, nonatomic) IBOutlet UILabel *middleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightImageVeiw;

@property (weak, nonatomic) IBOutlet UILabel *rightLabel;
@end

@implementation RenHouseBottomView

- (void)awakeFromNib{
    [super awakeFromNib];
    self.leftImageView.layer.cornerRadius = 16;
    
    self.leftImageView.layer.borderColor = lineGray.CGColor;
    self.leftImageView.layer.borderWidth = 0.6;
    self.leftImageView.layer.masksToBounds = YES;
    self.leftLabel.font = MYFONT(10);
    
    self.leftLabel.textColor = darkGray;
    
    self.middleLabel.font = MYFONT(17);
    self.rightLabel.font = MYFONT(17);
    
}


- (void)setModel:(HouseDetailModel *)model{
    _model = model;
    
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:_model.user_headimg] placeholderImage:[UIImage defaulIconImage]];
    
    
}

- (IBAction)leftBtnDidTap:(UIButton *)sender {
    
    
    if (!(myViewModel.userIsLogin)) {
        
        [myViewModel.rootController login];
        
        return;
    }
    
    __block UITextField *tf = nil;
    
    MJWeakSelf;
    [LEEAlert alert].config
    .LeeTitle(@"在线协助")
    .LeeContent(nil)
    .LeeAddTextField(^(UITextField *textField) {
        
        // 这里可以进行自定义的设置
        
        textField.font = MYFONT(13);
        
        textField.placeholder = @"输入您的需求,菲度客服将为您服务!";
        
        textField.textColor = [UIColor darkGrayColor];
        
        tf = textField; //赋值
    })
    .LeeAction(@"提交", ^{
        
        if (tf.text.length > 0) {
            
            [weakSelf.myVC onLineAskBtnDidTap:tf.text];
        }
        
        
        
        [tf resignFirstResponder];
    })
    .LeeCancelAction(@"取消", nil) // 点击事件的Block如果不需要可以传nil
    .LeeShow();
}





    

- (IBAction)rightBtnDidTap:(UIButton *)sender {
    
    NSString * str = [NSString stringWithFormat:@"telprompt://%@",_model.house_phone];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}


@end
